package com.crayon2f.test;

import com.crayon2f.test.beans.User;
import org.junit.Test;

/**
 * Created by feifan.gou@gmail.com on 2021/2/24 15:16.
 */
public class Reflect {

    @Test
    public void method() throws IllegalAccessException, InstantiationException, ClassNotFoundException {

        User user = new User();
        //1.通过类.class
        Class<? extends User> aClass = User.class;
        //2.通过实例.getClass()
        Class<? extends User> aClass2 = user.getClass();
        //3.通过Class.forName("类全名")
        Class<?> aClass1 = Class.forName(User.class.getName());

    }
}
